package cn.liontalk.service.impl;

import cn.liontalk.dao.User1Dao;
import cn.liontalk.entity.UserEntity;
import cn.liontalk.service.User1Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 周哲
 * @package: cn.liontalk.service.impl
 * @description:
 * @date: 2019/3/27 21:14
 * @version: V1.0
 */
@Service
public class User1ServiceImpl implements User1Service {

    private static final Logger logger = LoggerFactory.getLogger(User1ServiceImpl.class);

    @Autowired
    private User1Dao user1Dao;

    @Override
    public List<UserEntity> getAllUsers() {
        List<UserEntity> users=user1Dao.getAll();
        return users;
    }


    @Override
    public void insertUser(UserEntity user) {
        try {
            user1Dao.insert(user);
        } catch (Exception e) {
            logger.info("insert user into datasoure error!");
            throw e;
        }
    }


}
